/**
 * @filename:OrderPaymentServiceImpl 2019-01-17 14:56:43
 * @project skz  V1.3.3
 * Copyright(c) 2018 Liu,Wenzhao Co. Ltd. 
 * All right reserved. 
 */
package com.bingsum.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.github.pagehelper.PageHelper;

import java.util.List;

import com.bingsum.model.OrderPayment;
import com.bingsum.mapper.OrderPaymentMapper;

/**   
 *  
 * @Description:  [支付信息]——SERVICE
 * @Author:       Liu,Wenzhao   
 * @CreateDate:   2019-01-17 14:56:43
 * @Version:      V1.3.3
 *    
 */
@Service("orderPaymentService")
@Transactional(readOnly = true)
public class OrderPaymentService{

    @Autowired
    private OrderPaymentMapper orderPaymentMapper;
	
    public List<OrderPayment> getAll(OrderPayment orderPayment) {
        if (orderPayment.getPage() != null && orderPayment.getRows() != null) {
            PageHelper.startPage(orderPayment.getPage(), orderPayment.getRows());
        }
        return orderPaymentMapper.selectAll();
    }

    public OrderPayment getById(Integer id) {
        return orderPaymentMapper.selectByPrimaryKey(id);
    }
    
    @Transactional(readOnly = false)
    public void deleteById(Integer id) {
        orderPaymentMapper.deleteByPrimaryKey(id);
    }

    @Transactional(readOnly = false)
    public void save(OrderPayment orderPayment) {
        if (orderPayment.getId() != null) {
            orderPaymentMapper.updateByPrimaryKey(orderPayment);
        } else {
            orderPaymentMapper.insert(orderPayment);
        }
    }
}